import { request } from "@xiaoe/js-tools/lib/request";

//定义直播前缀
var alivePrefix = ""
function changealivePrefix(data){
  alivePrefix = data
}
// 商品的套餐信息
const getGoodsPackage = params => {
  return request({
    url: `${alivePrefix}/xe.spu.goods_package.detail/1.0.0`,
    params
  })
}
// 超级会员信息
const getSuperVipInfo = data => {
  return request({
    url: `${alivePrefix}/xe.svip.info.get_by_resource.detail/1.0.0`,
    params: data
  })
}
// 获取营销活动信息
function getMarketingInfo(params) {
  return request({
    url: `${alivePrefix}/xe.marketing.basic.activity.info/1.0.0`,
    params
  });
}
// 业务特性信息
function getBusinessFeature(spu_id) {
  return request({
    url: `${alivePrefix}/xe.ecommerce.goods_center.get_feature_info_detail/1.0.0`,
    params: {
      spu_id: spu_id,
    }
  })
}
//批价信息
function getPrePayInfoV3(params) {
  return request({
    url: `${alivePrefix}/xe.transaction.pay.order_info_v3.get/1.0.0`,
    params
  })
}

//地址信息
function getOrderAddressInfo(params) {
  return request({
    url: `${alivePrefix}/xe.order.address.info/1.0.0`,
    params
  })
}

//初始化店铺设置信息
function getShopConf() {
  return request({
    url: `${alivePrefix}/shop_conf/get_shop_module_conf`,
    params: {
      modules: ['switches', 'guideContact', 'physicalGoods']
    }
  });
}

//线下课信息
function checkOLCDuplicateOrder(params) {
  return request({
    url: `${alivePrefix}/faceTeach/check_student_class`,
    params
  });
}

//获取商家自提状态
function getDeliveryState(params) {
  return request({
    url: `${alivePrefix}/xe.ecommerce.logistics_go.get_self_pick_state/1.0.0`,
    params
  });
}

//获取虚拟币余额
function getBlance(params) {
  return request({
    url: `${alivePrefix}/xe.transaction.get.virtual.balance.user/1.0.0`,
    params
  });
}

//能否使用虚拟币支付
function canUseVirtual(params) {
  return request({
    url: `${alivePrefix}/xe.transaction.ios.coin/can_use/1.0.0`,
    params
  });
}

//直播发起订单页新增灰度
function newOrderGrayControl(params) {
  return request({
    url: `/xe.transact.code_gray_control/1.0.0`,
    params,
    pack: '',
    requestType: 'json'
  });
}

export {
  alivePrefix,
  getGoodsPackage,
  getSuperVipInfo,
  getMarketingInfo,
  getBusinessFeature,
  getPrePayInfoV3,
  getOrderAddressInfo,
  getShopConf,
  checkOLCDuplicateOrder,
  getDeliveryState,
  changealivePrefix,
  getBlance,
  canUseVirtual,
  newOrderGrayControl
};
